<%inherit file="/base_app.html"/>
<%block name="title_content">
    <a class="btn btn-green btn-min-w f_r mr10"  href="${SITE_URL}release/${app_info.get('code', '--')}/">发布部署</a>
</%block>
<%block name="right_content">
    <link rel="stylesheet" type="text/css" href="${STATIC_URL}css/paas_app.${CSS_SUFFIX}?v=${STATIC_VERSION}">
        <hr/>
        <div class="ml50 app-info">
            <div class="t_b mb10">注册信息
            </div>
            <div class="row">
                <div class="col-sm-4 col-xs-4">
                    <font class="t_grey">应用ID：</font>${app_info.get('code', '--')}
                </div>
                <div class="col-sm-8 col-xs-8">
                    <font class="t_grey">应用TOKEN：</font>${app_info.get('auth_token', '--')}
                </div>
            </div>
        </div>
        <hr/>
        <div class="ml50 app-info">
            <div class="t_b mb10">基本信息
                <div class="f_r mr30">
                    <a href="###" style="margin-left:10px;font-weight: 400;display:none;" class="can_a" id="base_cancle">取消</a>
                    <a href="###" style="margin-left:10px;font-weight: 400;" id="base_operate" data="0" class="operate" edit-class="base">编辑</a>
                </div>
                <span id="tip_name" style="color: #f00;" class="f_r app-info-tips"></span>
            </div>
            <div class="mb10" ></div>
            <div class="row">
                <div class="col-sm-4 col-xs-4">
                    <input type="hidden" id="app_code_id" value="${app_info.get('code', '--')}"></input>
                    <font class="t_grey">应用 ID：</font>${app_info.get('code', '--')}
                </div>
                <div class="col-sm-4 col-xs-4">
                    <div class=""><font class="t_grey">创建者：</font>${app_info.get('creater', '--')}</div>
                </div>
                <div class="col-sm-4 col-xs-4">
                    <font class="t_grey f_l">应用名称：</font>
                    <input type="text" class="form-control app-edit app-value" id="name" name="name" value="${app_info.get('name', '--')}" operation="modify" style="width:200px;margin-top:-6px;display:none;margin-left: 85px;">
                    <div id="app_name" class="base">${app_info.get('name', '--')}</div>
                </div>
            </div>
            <div class="row mt5 chmt">
                <div class="col-sm-4 col-xs-4">
                    <font class="t_grey">首次提测：</font>${app_info.get('first_test_time', '--') or '--'}
                </div>
                <div class="col-sm-4 col-xs-4">
                    <font class="t_grey">首次上线：</font>${app_info.get('first_online_time',  '--') or '--'}
                </div>
                <div class="col-sm-4 col-xs-4">
                    <font class="t_grey">开发语言：</font>Python（Django 1.8）
                </div>
            </div>
            <div class="row mt5 chmt">
                <div class="col-sm-10 col-xs-10" style="width:100%">
                    <div class="row" >
                        <div class="col-sm-2 col-xs-2">
                            <div><font class="t_grey">负责人：</font></div>
                        </div>
                        <div class="col-sm-8 col-xs-8" style="margin-left: -93px;">
                            <div id="developer_div" class="app-edit" style="display:none;margin-left: 7px;">
                                <select multiple="multiple" id="developer_select"  style="width: 545px;">
                                % for _user in app_info.get('users', []):
                                    % if _user['username'] in app_info.get('developers_value_name_list', []):
                                            <option value="${_user['username']}" selected >${_user['username']}</option>
                                    % else:
                                            <option value="${_user['username']}">${_user['username']}</option>
                                    % endif
                                % endfor
                                </select>
                            </div>
                                <input type="hidden" class="app-value" name="developer" id="developer" value="${app_info.get('developers_value_name', '')}">
                               <div id="app_developer" class="base" >${app_info.get('developers_value_name', '--')}</div>
                        </div>
                         <div class="col-sm-2 col-xs-2">
                            <div id="tip_developer" style="color: #f00;" class="app-info-tips"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <hr/>
        <div class="ml50 app-info">
            <div class="t_b mb10">访问地址
            </div>
            <div class="row">
                <div class="col-sm-10 col-xs-10">
                    <font class="t_grey">测试地址：</font> <span id="test_access_span"></span>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-10 col-xs-10">
                    <font class="t_grey">正式地址：</font> <span id="prod_access_span"></span>
                </div>
            </div>
        </div>
        <hr/>
        <div class="ml50 app-info">
            <div class="t_b mb10">应用简介
                <div class="f_r mr30">
                    <a href="###" style="margin-left:10px;font-weight: 400;display:none;" class="can_a" id="introduction_cancle">取消</a>
                    <a href="###" style="margin-left:10px;font-weight: 400;" id="intro_operate" data="0" class="operate" edit-class="introduction">编辑</a>
                </div>
                <span id="tip_introduction" style="color: #f00;" class="f_r app-info-tips"></span>
            </div>
            <div class="row">
                <div class="col-sm-10 col-xs-10">
                    <input type="text" class="form-control app-edit app-value" id="introduction" name="introduction"  value="${app_info.get('introduction', '')}" style="display:none;width:908px;">
                    <div id="intro_value" value="${app_info.get('introduction', '')}" class="introduction">${app_info.get('introduction', '--')}</div>
                </div>
            </div>
        </div>
        <hr/>
        <div class="mb10 ml50 app-info">
          <div class="t_b mb10">源代码管理信息
                 <div class="f_r mr30">
                    <a href="###" style="margin-left:10px;font-weight: 400;display:none;" class="can_a" id="vcs_cancle">取消</a>
                    <a href="###" style="margin-left:10px;font-weight: 400;" id="intro_operate" data="0" class="operate" edit-class="vcs">编辑</a>
                </div>
                <span id="tip_vcs" style="color: #f00;" class="f_r"></span>
          </div>
          <div class="row">
              <div class="col-sm-4 col-xs-4">
                  <input type="hidden" id='vcs_type_id' value="${app_info.get('vcs_type', '')}"> </input>
                  <font class="t_grey">代码仓库：</font>${app_info.get('vcs_type_name', '--') or '--'}
              </div>
            <div class="col-sm-8 col-xs-8">
              <font class="t_grey">地址：</font>
              <input type="text" class="form-control app-edit app-value" id="vcs_url" name="vcs_url" value="${app_info.get('vcs_url', '')}" style="display:none;width:278px;margin-bottom: 5px;">
              <span id="vcs_url_value" value="${app_info.get('vcs_url', '')}" class="vcs">${app_info.get('vcs_url', '--') or '--'}</span>
              <span id="tip_vcs_url" class="app-info-tips mt10 mb5 ml150 error"></span>
            </div>
          </div>
          <div class="row">
            <div class="col-sm-4 col-xs-4">
              <font class="t_grey">${app_info.get('vcs_type_name', '') or ''}帐号：</font>
              <input type="text" class="form-control app-edit app-value" id="vcs_username" name="vcs_username" value="${app_info.get('vcs_username', '--')}" style="display:none;width:200px;margin-bottom: 5px;">
              <span id="vcs_username_value" value="${app_info.get('vcs_username', '')}" class="vcs" >${app_info.get('vcs_username', '--') or '--'}</span>
              <br><span id="tip_vcs_username" class="app-info-tips mt10 mb5 ml150 error"></span>
            </div>
            <div class="col-sm-8 col-xs-8">
              <font class="t_grey">密码：</font>
              <!-- 防止Firefox下密码自动填充 -->
              <input type="text" style="display:none">
              <input type="password" style="display:none">
              <input type="text" onfocus="this.type='password'" class="form-control app-edit app-value" id="vcs_password" name="vcs_password" value="" style="display:none;width:278px;margin-bottom: 5px;">
              <span id="vcs_password_value" class="vcs" >******</span>
              <a href="###" title="显示密码" class="ml5 password_show" data="0"><i class="bk-icon icon-eye t_b t_s12" style="transform: scale(0.8,0.8);"></i></a>
             <span id="tip_vcs_password" class="app-info-tips mt10 mb5 ml150 error"></span>
            </div>
          </div>
        </div>
        <hr/>
        <div class="ml50">
            <div class="t_b mb10">删除应用</div>
            <div class="row">
                <div class="col-sm-10 col-xs-10">
                    % if request.user.username != app_info.get('creater'):
                        <div class="mb5">非创建人不允许删除应用，如需删除请联系创建人。</div>
                    % elif app_info.get('state', '') == 1:
                        <div class="mb5">只有创建人能删除该应用，请在删除前与其他同事提前沟通，确定<a href="###" onclick="REL_MANAGER.app_del(this, '${app_info.get('code', '')}');" app_code="${app_info.get('code', '')}" class="hit app_del"><strong>删除</strong></a>!</div>
                    % else:
                        <div class="mb5">只有开发中的应用才能删除，提测和上线过的应用不能删除！</div>
                    % endif
                </div>
            </div>
        </div><hr/>
</%block>

<script src="${STATIC_URL}js/paas_release.${JS_SUFFIX}"></script>
<script src="${STATIC_URL}js/paas_app.${JS_SUFFIX}"></script>
<script type="text/javascript">
    $(function(){
        APP_INFO.get_access_info('${app_code}');
    })
</script>
